import 'package:flutter/material.dart';

/// 应用配置类
class AppConfig {
  /// 应用名称
  final String appName;
  
  /// 应用包名
  final String packageName;
  
  /// 应用图标路径
  final String iconPath;
  
  /// 应用主题色
  final Color primaryColor;
  
  /// 应用次要颜色
  final Color secondaryColor;
  
  /// EHR链接地址
  final String? ehrUrl;
  
  /// 是否是EHR渠道
  final bool isEhr;
  
  /// 构造函数
  const AppConfig({
    required this.appName,
    required this.packageName,
    required this.iconPath,
    required this.primaryColor,
    required this.secondaryColor,
    this.ehrUrl,
    this.isEhr = false,
  });
  
  /// 家庭医生应用配置
  static const AppConfig homeDoctorConfig = AppConfig(
    appName: '健康管家',
    packageName: 'com.example.home_doctor',
    iconPath: 'assets/images/icon_a.png',
    primaryColor: Color(0xFF4285F4),
    secondaryColor: Color(0xFF34A0F2),
  );
  
  /// 移动医生查房应用配置
  static const AppConfig mobileDoctorConfig = AppConfig(
    appName: '医生助手',
    packageName: 'com.example.mobile_doctor',
    iconPath: 'assets/images/icon_b.png',
    primaryColor: Color(0xFF4285F4),
    secondaryColor: Color(0xFF34A0F2),
  );
  
  /// 移动医疗应用配置
  static const AppConfig mobileMedicalConfig = AppConfig(
    appName: '智慧医疗',
    packageName: 'com.example.mobile_medical',
    iconPath: 'assets/images/icon_c.png',
    primaryColor: Color(0xFF4285F4),
    secondaryColor: Color(0xFF34A0F2),
  );
  
  /// EHR应用配置
  static const AppConfig ehrConfig = AppConfig(
    appName: 'EHR系统',
    packageName: 'com.example.ehr',
    iconPath: 'assets/images/icon_c.png',
    primaryColor: Color(0xFF4285F4),
    secondaryColor: Color(0xFF34A0F2),
    ehrUrl: 'http://localhost:41911/Views/EHR/EHR_Login.html?apptype=1&sign=CDB48762342F3868718B76DE8B981EE3&timeStamp=1681444014',
    isEhr: true,
  );
  
  /// 当前应用配置
  static late final AppConfig _instance;
  
  /// 初始化应用配置
  static void init({required String flavor}) {
    switch (flavor) {
      case 'home_doctor':
        _instance = homeDoctorConfig;
        break;
      case 'mobile_doctor':
        _instance = mobileDoctorConfig;
        break;
      case 'mobile_medical':
        _instance = mobileMedicalConfig;
        break;
      case 'ehr':
        _instance = ehrConfig;
        break;
      default:
        _instance = homeDoctorConfig; // 默认使用家庭医生配置
    }
  }
  
  /// 获取当前应用配置
  static AppConfig get instance => _instance;
}